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


PHP Expr::in方法代码示例

本文整理汇总了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;
 }
开发者ID:msojda,项目名称:cli,代码行数:62,代码来源:MapCommandHandler.php

示例2: orIn

 public function orIn(array $values)
 {
     return $this->orX(Expr::in($values));
 }
开发者ID:webmozart,项目名称:expression,代码行数:4,代码来源:OrX.php

示例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));
 }
开发者ID:niklongstone,项目名称:manager,代码行数:13,代码来源:ConfigFileManagerImplTest.php

示例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);
 }
开发者ID:webmozart,项目名称:cli,代码行数:30,代码来源:PackageCommandHandler.php

示例5: states

 private function states(array $states)
 {
     return Expr::in($states, Package::STATE);
 }
开发者ID:rejinka,项目名称:cli,代码行数:4,代码来源:PackageCommandHandlerTest.php

示例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'));
 }
开发者ID:niklongstone,项目名称:manager,代码行数:12,代码来源:RootPackageFileManagerImplTest.php

示例7: packagesAndState

 private function packagesAndState(array $packageNames, $state)
 {
     return Expr::in($packageNames, PathMapping::CONTAINING_PACKAGE)->andSame($state, PathMapping::STATE);
 }
开发者ID:rejinka,项目名称:cli,代码行数:4,代码来源:MapCommandHandlerTest.php

示例8: andIn

 public function andIn(array $values)
 {
     return $this->andX(Expr::in($values));
 }
开发者ID:webmozart,项目名称:expression,代码行数:4,代码来源:AndX.php


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