本文整理汇总了PHP中Webmozart\Expression\Expr::in方法的典型用法代码示例。如果您正苦于以下问题:PHP Expr::in方法的具体用法?PHP Expr::in怎么用?PHP Expr::in使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Webmozart\Expression\Expr
的用法示例。
在下文中一共展示了Expr::in方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleList
/**
* Handles the "puli map --list" command.
*
* @param Args $args The console arguments.
* @param IO $io The I/O.
*
* @return int The status code.
*/
public function handleList(Args $args, IO $io)
{
$packageNames = ArgsUtil::getPackageNames($args, $this->packages);
$states = $this->getPathMappingStates($args);
$printState = count($states) > 1;
$printPackageName = count($packageNames) > 1;
$printHeaders = $printState || $printPackageName;
$printAdvice = true;
$indentation = $printState && $printPackageName ? 8 : ($printState || $printPackageName ? 4 : 0);
foreach ($states as $state) {
$statePrinted = !$printState;
if (PathMappingState::CONFLICT === $state) {
$expr = Expr::method('getContainingPackage', Expr::method('getName', Expr::in($packageNames)))->andMethod('getState', Expr::same($state));
$mappings = $this->repoManager->findPathMappings($expr);
if (!$mappings) {
continue;
}
$printAdvice = false;
if ($printState) {
$this->printPathMappingStateHeader($io, $state);
}
$this->printConflictTable($io, $mappings, $printState ? 4 : 0);
if ($printHeaders) {
$io->writeLine('');
}
continue;
}
foreach ($packageNames as $packageName) {
$expr = Expr::method('getContainingPackage', Expr::method('getName', Expr::same($packageName)))->andMethod('getState', Expr::same($state));
$mappings = $this->repoManager->findPathMappings($expr);
if (!$mappings) {
continue;
}
$printAdvice = false;
if (!$statePrinted) {
$this->printPathMappingStateHeader($io, $state);
$statePrinted = true;
}
if ($printPackageName) {
$prefix = $printState ? ' ' : '';
$io->writeLine(sprintf('%sPackage: %s', $prefix, $packageName));
$io->writeLine('');
}
$this->printMappingTable($io, $mappings, $indentation, PathMappingState::ENABLED === $state);
if ($printHeaders) {
$io->writeLine('');
}
}
}
if ($printAdvice) {
$io->writeLine('No path mappings. Use "puli map <path> <file>" to map a Puli path to a file or directory.');
}
return 0;
}
示例2: orIn
public function orIn(array $values)
{
return $this->orX(Expr::in($values));
}
示例3: testRemoveConfigKeysRevertsIfSavingNotPossible
public function testRemoveConfigKeysRevertsIfSavingNotPossible()
{
$this->configFile->getConfig()->set(Config::PULI_DIR, 'my-puli-dir');
$this->configFileStorage->expects($this->once())->method('saveConfigFile')->willThrowException(new TestException());
try {
$this->manager->removeConfigKeys(Expr::in(array(Config::PULI_DIR, Config::FACTORY_IN_FILE)));
$this->fail('Expected a TestException');
} catch (TestException $e) {
}
$this->assertTrue($this->configFile->getConfig()->contains(Config::PULI_DIR));
$this->assertFalse($this->configFile->getConfig()->contains(Config::FACTORY_IN_FILE));
$this->assertSame('my-puli-dir', $this->configFile->getConfig()->get(Config::PULI_DIR));
}
示例4: getSelectedPackages
/**
* Returns the packages that should be displayed for the given console
* arguments.
*
* @param Args $args The console arguments.
*
* @return PackageCollection The packages.
*/
private function getSelectedPackages(Args $args)
{
$states = $this->getSelectedStates($args);
$expr = Expr::true();
$envs = array();
if ($states !== PackageState::all()) {
$expr = $expr->andMethod('getState', Expr::in($states));
}
if ($args->isOptionSet('installer')) {
$expr = $expr->andMethod('getInstallInfo', Expr::method('getInstallerName', Expr::same($args->getOption('installer'))));
}
if ($args->isOptionSet('prod')) {
$envs[] = Environment::PROD;
}
if ($args->isOptionSet('dev')) {
$envs[] = Environment::DEV;
}
if (count($envs) > 0) {
$expr = $expr->andMethod('getInstallInfo', Expr::method('getEnvironment', Expr::in($envs)));
}
return $this->packageManager->findPackages($expr);
}
示例5: states
private function states(array $states)
{
return Expr::in($states, Package::STATE);
}
示例6: testRemoveExtraKeysRestoresPreviousValuesIfSavingFails
public function testRemoveExtraKeysRestoresPreviousValuesIfSavingFails()
{
$this->rootPackageFile->setExtraKey('key1', 'previous');
$this->packageFileStorage->expects($this->once())->method('saveRootPackageFile')->with($this->rootPackageFile)->will($this->throwException(new TestException()));
try {
$this->manager->removeExtraKeys(Expr::in(array('key1', 'key2')));
$this->fail('Expected a TestException');
} catch (TestException $e) {
}
$this->assertSame('previous', $this->rootPackageFile->getExtraKey('key1'));
$this->assertFalse($this->rootPackageFile->hasExtraKey('key2'));
}
示例7: packagesAndState
private function packagesAndState(array $packageNames, $state)
{
return Expr::in($packageNames, PathMapping::CONTAINING_PACKAGE)->andSame($state, PathMapping::STATE);
}
示例8: andIn
public function andIn(array $values)
{
return $this->andX(Expr::in($values));
}