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


PHP MessageCatalogue::get方法代码示例

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


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

示例1: applyVersion

 /**
  * Applies version to the supplied path.
  *
  * @param string           $path    A path
  * @param string|bool|null $version A specific version
  *
  * @return string The versionized path
  */
 protected function applyVersion($path, $version = null)
 {
     $file = $path;
     // apply the base path
     if ('/' !== substr($path, 0, 1)) {
         $file = $this->basePath . $path;
     }
     $reved = $this->summary->get($file);
     $fullpath = $this->getRoot() . $file;
     $fullreved = $this->getRoot() . $reved;
     // $reved or unversioned
     if (file_exists($fullreved)) {
         return $reved;
         // fallback
     } else {
         $pattern = preg_replace('/\\.([^\\.]+$)/', '.*.$1', $fullpath);
         $regex = preg_replace('/\\.([^\\.]+$)/', '\\.[\\d\\w]{8}\\.$1', $fullpath);
         $base = str_replace($path, '', $fullpath);
         foreach (glob($pattern) as $filepath) {
             if (preg_match('#' . $regex . '#', $filepath)) {
                 $result = str_replace($base, '', $filepath);
                 $this->summary->set($file, $result);
                 return $result;
             }
         }
     }
     return $path;
 }
开发者ID:kuborgh-xalejado,项目名称:generator-grunt-symfony,代码行数:36,代码来源:FilerevPackage.php

示例2: get

 /**
  * {@inheritdoc}
  */
 public function get($id, $domain = 'messages')
 {
     if ($this->defines($id, $domain)) {
         return parent::get($id, $domain);
     }
     if ($this->getFallbackCatalogue() !== NULL) {
         return $this->getFallbackCatalogue()->get($id, $domain);
     }
     return "";
 }
开发者ID:tomasstrejcek,项目名称:Translation,代码行数:13,代码来源:MessageCatalogue.php

示例3: testAddFallbackCatalogue

 public function testAddFallbackCatalogue()
 {
     $r = $this->getMock('Symfony\\Component\\Config\\Resource\\ResourceInterface');
     $r->expects($this->any())->method('__toString')->will($this->returnValue('r'));
     $r1 = $this->getMock('Symfony\\Component\\Config\\Resource\\ResourceInterface');
     $r1->expects($this->any())->method('__toString')->will($this->returnValue('r1'));
     $catalogue = new MessageCatalogue('en_US', array('domain1' => array('foo' => 'foo'), 'domain2' => array('bar' => 'bar')));
     $catalogue->addResource($r);
     $catalogue1 = new MessageCatalogue('en', array('domain1' => array('foo' => 'bar', 'foo1' => 'foo1')));
     $catalogue1->addResource($r1);
     $catalogue->addFallbackCatalogue($catalogue1);
     $this->assertEquals('foo', $catalogue->get('foo', 'domain1'));
     $this->assertEquals('foo1', $catalogue->get('foo1', 'domain1'));
     $this->assertEquals(array($r, $r1), $catalogue->getResources());
 }
开发者ID:Ener-Getick,项目名称:symfony,代码行数:15,代码来源:MessageCatalogueTest.php

示例4: getRevedFilename

 /**
  * Get reved filename from summary
  *
  * @param $file
  *
  * @return string
  */
 protected function getRevedFilename($file)
 {
     $this->initializeCacheCatalogue();
     return $this->summary->get($file);
 }
开发者ID:kuborgh-bzoerb,项目名称:FilerevBundle,代码行数:12,代码来源:JsonVersionStrategy.php


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