本文整理汇总了PHP中resolve函数的典型用法代码示例。如果您正苦于以下问题:PHP resolve函数的具体用法?PHP resolve怎么用?PHP resolve使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resolve函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
/**
* The entry method.
*
* @return void
*/
public function main()
{
$run = 'hoa://Data/Variable/Run';
while (false !== ($c = $this->getOption($v))) {
switch ($c) {
case 'r':
$run = $v;
break;
case 'h':
case '?':
return $this->usage();
case '__ambiguous':
$this->resolveOptionAmbiguity($v);
break;
}
}
$this->parser->listInputs($workerId);
if (null === $workerId) {
return $this->usage();
}
$run = resolve($run);
$protocol = Protocol::getInstance();
$protocol['Data']['Variable']['Run']->setReach("\r" . $run . DS);
$password = $this->readPassword('Password: ');
$sw = new Worker\Backend\Shared($workerId, $password);
$sw->stop();
return;
}
示例2: getResolved
protected function getResolved()
{
$router = $this->router->get();
$data = $this->router->get('data');
if (isset($router['resolvers'])) {
foreach ($router['resolvers'] as $urlKey => $resolver) {
$resolved = resolve($resolver)->resolve($router[$urlKey] ?? $this->router->getCleanUri());
if (is_string($urlKey)) {
$data[$urlKey] = $resolved;
}
$data[] = $resolved;
if (!is_int($urlKey)) {
$this->router->resolve($urlKey, $resolved);
/**
* Remove resolved key.
* Why? Can we delete it?
*/
if (isset($data[$urlKey])) {
//unset($data[$urlKey]);
}
}
}
}
return $data;
}
示例3: execute
/**
* @throws Exception
*/
public function execute(callable $next)
{
/**
* Skip database initialization if connections are not defined.
*/
if (!$this->config->get('database')) {
return $next();
}
$configs = $this->config->get('database');
foreach ($configs as $name => $config) {
if (isset($config['lazy'])) {
continue;
}
$repository = null;
if ($config['driver'] == 'faker') {
$repository = new RepositoryFaker(Factory::create());
} elseif ($config['driver'] == 'middleware') {
$repository = resolve($config['middleware'])->execute(function () {
});
} else {
$repository = $this->initPdoDatabase($config, $name);
}
if ($repository) {
$this->context->bindIfNot(Repository::class, $repository);
$this->context->bind(Repository::class . '.' . $name, $repository);
}
}
return $next();
}
示例4: resolve
private function resolve($value = null)
{
if (null !== $this->result) {
return;
}
$this->settle(resolve($value));
}
示例5: resolve
function resolve($op, &$z)
{
$ops = explode(' ', $op);
if (count($ops) === 1) {
if (isset($z[$ops[0]]) && !is_numeric($ops[0])) {
return $z[$ops[0]] = (int) resolve($z[$ops[0]], $z);
}
return $z[$ops[0]] = (int) $ops[0];
}
if (count($ops) === 2) {
return $z[$ops[1]] = ~(int) resolve($ops[1], $z);
}
$a = resolve($ops[0], $z);
$b = resolve($ops[2], $z);
switch ($ops[1]) {
case 'AND':
$r = $a & $b;
break;
case 'OR':
$r = $a | $b;
break;
case 'LSHIFT':
$r = $a << $b;
break;
case 'RSHIFT':
$r = $a >> $b;
break;
default:
throw new Exception('Unknown op: ' . $ops[1]);
}
return (int) $r;
}
示例6: always
public function always(callable $onFulfilledOrRejected)
{
return $this->then(function ($value) use($onFulfilledOrRejected) {
return resolve($onFulfilledOrRejected())->then(function () use($value) {
return $value;
});
});
}
示例7: shouldPreserveTheOrderOfArrayWhenResolvingAsyncPromises
/** @test */
public function shouldPreserveTheOrderOfArrayWhenResolvingAsyncPromises()
{
$mock = $this->createCallableMock();
$mock->expects($this->once())->method('__invoke')->with($this->identicalTo([1, 2, 3]));
$deferred = new Deferred();
all([resolve(1), $deferred->promise(), resolve(3)])->then($mock);
$deferred->resolve(2);
}
示例8: always
public function always(callable $onFulfilledOrRejected)
{
return $this->then(null, function ($reason) use($onFulfilledOrRejected) {
return resolve($onFulfilledOrRejected())->then(function () use($reason) {
return new RejectedPromise($reason);
});
});
}
示例9: test_update_configuration_replaces_user_and_group_in_config_file
public function test_update_configuration_replaces_user_and_group_in_config_file()
{
copy(__DIR__ . '/files/fpm.conf', __DIR__ . '/output/fpm.conf');
resolve(StubForUpdatingFpmConfigFiles::class)->updateConfiguration();
$contents = file_get_contents(__DIR__ . '/output/fpm.conf');
$this->assertTrue(strpos($contents, 'user = ' . user()) !== false);
$this->assertTrue(strpos($contents, 'listen.owner = ' . user()) !== false);
}
示例10: test_update_domain_removes_old_resolver_and_reinstalls
public function test_update_domain_removes_old_resolver_and_reinstalls()
{
$cli = Mockery::mock(CommandLine::class);
$cli->shouldReceive('quietly')->with('rm /etc/resolver/old');
$dnsMasq = Mockery::mock(DnsMasq::class . '[install]', [resolve(Brew::class), $cli, new Filesystem()]);
$dnsMasq->shouldReceive('install')->with('new');
$dnsMasq->updateDomain('old', 'new');
}
示例11: always
public function always(callable $onFulfilledOrRejected) : ExtendedPromiseInterface
{
return $this->then(function ($value) use($onFulfilledOrRejected) {
return resolve($onFulfilledOrRejected())->then(function () use($value) {
return $value;
});
});
}
示例12: case_splFileClassInfo
public function case_splFileClassInfo()
{
$this->given($splFileInfo = 'Hoa\\Iterator\\SplFileInfo', $root = resolve('hoa://Test/Vfs/Root?type=directory'), resolve('hoa://Test/Vfs/Root/a?type=file'), resolve('hoa://Test/Vfs/Root/b?type=file'), resolve('hoa://Test/Vfs/Root/c?type=file'), resolve('hoa://Test/Vfs/Root/d?type=file'), resolve('hoa://Test/Vfs/Root/e?type=file'), resolve('hoa://Test/Vfs/Root/f?type=file'), $iterator = new LUT\FileSystem($root, LUT\FileSystem::CURRENT_AS_FILEINFO, $splFileInfo), $result = [])->when(function () use($iterator, $splFileInfo, &$result) {
foreach ($iterator as $file) {
$this->object($file)->isInstanceOf($splFileInfo);
$result[] = $file->getFilename();
}
})->then->array($result)->isEqualTo(['a', 'b', 'c', 'd', 'e', 'f']);
}
示例13: test_drivers_directory_is_created_with_sample_driver_if_it_doesnt_exist
public function test_drivers_directory_is_created_with_sample_driver_if_it_doesnt_exist()
{
$files = Mockery::mock(Filesystem::class . '[isDir,mkdirAsUser,putAsUser]');
$files->shouldReceive('isDir')->with(VALET_HOME_PATH . '/Drivers')->andReturn(false);
$files->shouldReceive('mkdirAsUser')->with(VALET_HOME_PATH . '/Drivers');
$files->shouldReceive('putAsUser');
swap(Filesystem::class, $files);
resolve(Configuration::class)->createDriversDirectory();
}
示例14: getSerializerInstance
private function getSerializerInstance($something)
{
if (!$something) {
return new JsonSerializer();
}
$serializer = is_string($something) ? resolve($something) : $something;
if ($serializer instanceof SerializerAbstract) {
return $serializer;
}
}
示例15: then
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
{
if (null === $this->promise) {
try {
$this->promise = resolve(call_user_func($this->factory));
} catch (\Exception $exception) {
$this->promise = new RejectedPromise($exception);
}
}
return $this->promise->then($onFulfilled, $onRejected, $onProgress);
}