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


PHP Intl::isExtensionLoaded方法代码示例

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


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

示例1: testToString

 public function testToString($value, $currencyCode, $expectedOutput)
 {
     if (Intl::isExtensionLoaded()) {
         \Locale::setDefault('en');
     }
     $this->if($price = new TestedPrice($value, $currencyCode))->string((string) $price)->isIdenticalTo($expectedOutput);
 }
开发者ID:rayhan0421,项目名称:accounting,代码行数:7,代码来源:Price.php

示例2: requireFullIntl

 /**
  * Should be called before tests that require a feature-complete intl
  * implementation.
  *
  * @param \PhpUnit_Framework_TestCase $testCase
  */
 public static function requireFullIntl(\PhpUnit_Framework_TestCase $testCase)
 {
     // We only run tests if the intl extension is loaded...
     if (!Intl::isExtensionLoaded()) {
         $testCase->markTestSkipped('The intl extension is not available.');
     }
     // ... and only if the version is *one specific version* ...
     if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
         $testCase->markTestSkipped('Please change ICU version to ' . Intl::getIcuStubVersion());
     }
     // ... and only if the data in the Icu component matches that version.
     if (IcuVersion::compare(Intl::getIcuDataVersion(), Intl::getIcuStubVersion(), '!=', $precision = 1)) {
         $testCase->markTestSkipped('Please change the Icu component to version 1.0.x or 1.' . IcuVersion::normalize(Intl::getIcuStubVersion(), 1) . '.x');
     }
     // Normalize the default locale in case this is not done explicitly
     // in the test
     \Locale::setDefault('en');
     // Consequently, tests will
     //
     //   * run only for one ICU version (see Intl::getIcuStubVersion())
     //     there is no need to add control structures to your tests that
     //     change the test depending on the ICU version.
     //   * always use the C intl classes
     //   * always use the binary resource bundles (any locale is allowed)
 }
开发者ID:bonett23,项目名称:pruebaTweetsSymfony2Hely,代码行数:31,代码来源:IntlTestHelper.php

示例3: load

 /**
  * {@inheritdoc}
  */
 public function load(ObjectManager $manager)
 {
     $countryRepository = $this->getCountryRepository();
     $countries = Intl::getRegionBundle()->getCountryNames($this->defaultLocale);
     if (Intl::isExtensionLoaded()) {
         $localisedCountries = array('es_ES' => Intl::getRegionBundle()->getCountryNames('es_ES'));
     } else {
         $localisedCountries = array();
     }
     foreach ($countries as $isoName => $name) {
         $country = $countryRepository->createNew();
         $country->setCurrentLocale($this->defaultLocale);
         $country->setName($name);
         foreach ($localisedCountries as $locale => $translatedCountries) {
             $country->setCurrentLocale($locale);
             $country->setName($translatedCountries[$isoName]);
         }
         $country->setIsoName($isoName);
         if ('US' === $isoName) {
             $this->addUsStates($country);
         }
         $manager->persist($country);
         $this->setReference('Sylius.Country.' . $isoName, $country);
     }
     $manager->flush();
 }
开发者ID:nmarmon,项目名称:Sylius,代码行数:29,代码来源:LoadCountriesData.php

示例4: setUp

 protected function setUp()
 {
     // We only run tests if the intl extension is loaded...
     if (!Intl::isExtensionLoaded()) {
         $this->markTestSkipped('The intl extension is not available.');
     }
     $this->reader = new IntlBundleReader();
 }
开发者ID:Aryellix,项目名称:scrumator,代码行数:8,代码来源:IntlBundleReaderTest.php

示例5: setUp

 protected function setUp()
 {
     if (!Intl::isExtensionLoaded()) {
         $this->markTestSkipped('The intl extension is not available.');
     }
     if (IcuVersion::compare(Intl::getIcuVersion(), '4.4', '<', $precision = 1)) {
         $this->markTestSkipped('Please change your ICU version to 4.4 or higher');
     }
 }
开发者ID:acappel01,项目名称:opencall,代码行数:9,代码来源:IcuTestCase.php

示例6: testWriteResourceBundle

 public function testWriteResourceBundle()
 {
     // We only run tests if the intl extension is loaded...
     if (!Intl::isExtensionLoaded()) {
         $this->markTestSkipped('The intl extension is not available.');
     }
     $bundle = new \ResourceBundle('rb', __DIR__ . '/Fixtures', false);
     $this->writer->write($this->directory, 'en', $bundle);
     $this->assertFileEquals(__DIR__ . '/Fixtures/rb.json', $this->directory . '/en.json');
 }
开发者ID:Aryellix,项目名称:scrumator,代码行数:10,代码来源:JsonBundleWriterTest.php

示例7: buildFormatter

 private function buildFormatter($locale)
 {
     if (!Intl::isExtensionLoaded()) {
         // This number formatter don't have exactly the same behavior
         $formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY);
     } else {
         $formatter = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
     }
     return $formatter;
 }
开发者ID:rezzza,项目名称:accounting,代码行数:10,代码来源:Price.php

示例8: getFormatter

 public function getFormatter()
 {
     if (null === $this->formatter) {
         if (!Intl::isExtensionLoaded()) {
             // This number formatter don't have exactly the same behavior
             $this->formatter = new NumberFormatter('en', NumberFormatter::CURRENCY);
         } else {
             $this->formatter = new \NumberFormatter(\Locale::getDefault(), \NumberFormatter::CURRENCY);
         }
     }
     return $this->formatter;
 }
开发者ID:rezzza,项目名称:accounting,代码行数:12,代码来源:Price.php

示例9: testWriteResourceBundle

 public function testWriteResourceBundle()
 {
     // We only run tests if the intl extension is loaded...
     if (!Intl::isExtensionLoaded()) {
         $this->markTestSkipped('The intl extension is not available.');
     }
     if (PHP_VERSION_ID < 50315 || PHP_VERSION_ID >= 50400 && PHP_VERSION_ID < 50404) {
         $this->markTestSkipped('ResourceBundle implements Traversable only as of PHP 5.3.15 and 5.4.4');
     }
     $bundle = new \ResourceBundle('rb', __DIR__ . '/Fixtures', false);
     $this->writer->write($this->directory, 'en', $bundle);
     $this->assertFileEquals(__DIR__ . '/Fixtures/rb.php', $this->directory . '/en.php');
 }
开发者ID:Aryellix,项目名称:scrumator,代码行数:13,代码来源:PhpBundleWriterTest.php

示例10: requireFullIntl

 /**
  * Should be called before tests that require a feature-complete intl
  * implementation.
  */
 public static function requireFullIntl(\PHPUnit_Framework_TestCase $testCase, $minimumIcuVersion = null)
 {
     // We only run tests if the intl extension is loaded...
     if (!Intl::isExtensionLoaded()) {
         $testCase->markTestSkipped('Extension intl is required.');
     }
     self::requireIntl($testCase, $minimumIcuVersion);
     // Consequently, tests will
     //
     //   * run only for one ICU version (see Intl::getIcuStubVersion())
     //     there is no need to add control structures to your tests that
     //     change the test depending on the ICU version.
     //   * always use the C intl classes
 }
开发者ID:yceruto,项目名称:symfony,代码行数:18,代码来源:IntlTestHelper.php

示例11: requireFullIntl

 /**
  * Should be called before tests that require a feature-complete intl
  * implementation.
  *
  * @param \PhpUnit_Framework_TestCase $testCase
  */
 public static function requireFullIntl(\PHPUnit_Framework_TestCase $testCase)
 {
     // We only run tests if the intl extension is loaded...
     if (!Intl::isExtensionLoaded()) {
         $testCase->markTestSkipped('Extension intl is required.');
     }
     // ... and only if the version is *one specific version*
     if (IcuVersion::compare(Intl::getIcuVersion(), Intl::getIcuStubVersion(), '!=', 1)) {
         $testCase->markTestSkipped('ICU version ' . Intl::getIcuStubVersion() . ' is required.');
     }
     // Normalize the default locale in case this is not done explicitly
     // in the test
     \Locale::setDefault('en');
     // Consequently, tests will
     //
     //   * run only for one ICU version (see Intl::getIcuStubVersion())
     //     there is no need to add control structures to your tests that
     //     change the test depending on the ICU version.
     //   * always use the C intl classes
 }
开发者ID:unexge,项目名称:symfony,代码行数:26,代码来源:IntlTestHelper.php

示例12: centered

If you also built the repository before, you can pass the directory where that
build is stored in the second parameter. The build directory needs to contain
the subdirectories bin/ and lib/.

For running this script, the intl extension must be loaded and all vendors
must have been installed through composer:

composer install

MESSAGE
);
}
echo LINE;
echo centered('ICU Resource Bundle Compilation') . "\n";
echo LINE;
if (!Intl::isExtensionLoaded()) {
    bailout('The intl extension for PHP is not installed.');
}
$filesystem = new Filesystem();
$urls = parse_ini_file(__DIR__ . '/icu.ini');
echo "icu.ini parsed. Available versions:\n";
$maxVersion = 0;
foreach ($urls as $urlVersion => $url) {
    $maxVersion = IcuVersion::compare($maxVersion, $urlVersion, '<') ? $urlVersion : $maxVersion;
    echo "  {$urlVersion}\n";
}
$shortIcuVersion = strip_minor_versions($maxVersion);
if ($argc >= 2) {
    $sourceDir = $argv[1];
    $svn = new SvnRepository($sourceDir);
    echo "Using existing SVN repository at {$sourceDir}.\n";
开发者ID:Ener-Getick,项目名称:symfony,代码行数:31,代码来源:update-data.php

示例13: setUp

 protected function setUp()
 {
     if (!Intl::isExtensionLoaded()) {
         $this->markTestSkipped('The intl extension is not available.');
     }
 }
开发者ID:bonett23,项目名称:pruebaTweetsSymfony2Hely,代码行数:6,代码来源:IcuTestCase.php


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