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


PHP Registry::getInstance方法代码示例

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


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

示例1: __construct

 public function __construct(&$subject, $config = array())
 {
     parent::__construct($subject, $config);
     // Prepare log object
     $registry = Registry::getInstance("com_crowdfunding");
     /** @var  $registry Registry */
     $fileName = $registry->get("logger.file");
     $tableName = $registry->get("logger.table");
     // Create log object
     $this->log = new Prism\Log\Log();
     // Set database writer.
     $this->log->addWriter(new Prism\Log\Writer\Database(\JFactory::getDbo(), $tableName));
     // Set file writer.
     if (!empty($fileName)) {
         $app = \JFactory::getApplication();
         /** @var $app \JApplicationSite */
         $file = \JPath::clean($app->get("log_path") . DIRECTORY_SEPARATOR . $fileName);
         $this->log->addWriter(new Prism\Log\Writer\File($file));
     }
 }
开发者ID:bharatthakkar,项目名称:CrowdFunding,代码行数:20,代码来源:Plugin.php

示例2: getState

 /**
  * @return  Registry
  */
 protected function getState()
 {
     return Registry::getInstance($this->_statekey);
 }
开发者ID:RustyIngles,项目名称:sp4k_php,代码行数:7,代码来源:trait.php

示例3: testGetInstance

 /**
  * Test the Joomla\Registry\Registry::getInstance method.
  *
  * @return  void
  *
  * @covers  Joomla\Registry\Registry::getInstance
  * @since   1.0
  */
 public function testGetInstance()
 {
     // Test INI format.
     $a = Registry::getInstance('a');
     $b = Registry::getInstance('a');
     $c = Registry::getInstance('c');
     // Check the object type.
     $this->assertInstanceOf('\\Joomla\\Registry\\Registry', $a, 'Line ' . __LINE__ . ' - Object $a should be an instance of Registry.');
     // Check cache handling for same registry id.
     $this->assertThat($a, $this->identicalTo($b), 'Line: ' . __LINE__ . '.');
     // Check cache handling for different registry id.
     $this->assertThat($a, $this->logicalNot($this->identicalTo($c)), 'Line: ' . __LINE__ . '.');
 }
开发者ID:beingsane,项目名称:quickcontent,代码行数:21,代码来源:RegistryTest.php

示例4: testGetInstance

 /**
  * Test the Joomla\Registry\Registry::getInstance method.
  *
  * @return  void
  *
  * @covers  Joomla\Registry\Registry::getInstance
  * @since   1.0
  */
 public function testGetInstance()
 {
     // Test INI format.
     $a = Registry::getInstance('a');
     $b = Registry::getInstance('a');
     $c = Registry::getInstance('c');
     // Check the object type.
     $this->assertThat($a instanceof Joomla\Registry\Registry, $this->isTrue(), 'Line: ' . __LINE__ . '.');
     // Check cache handling for same registry id.
     $this->assertThat($a, $this->identicalTo($b), 'Line: ' . __LINE__ . '.');
     // Check cache handling for different registry id.
     $this->assertThat($a, $this->logicalNot($this->identicalTo($c)), 'Line: ' . __LINE__ . '.');
 }
开发者ID:ZerGabriel,项目名称:joomla-framework,代码行数:21,代码来源:RegistryTest.php

示例5: testACachedRegistryInstanceIsReturned

 /**
  * @testdox  A cached Registry instance is returned
  *
  * @covers   Joomla\Registry\Registry::getInstance
  */
 public function testACachedRegistryInstanceIsReturned()
 {
     $a = Registry::getInstance('a');
     $b = Registry::getInstance('a');
     $c = Registry::getInstance('c');
     $this->assertInstanceOf('Joomla\\Registry\\Registry', $a, 'A Registry instance should be returned.');
     $this->assertSame($a, $b, 'The same Registry instance should be returned when requesting the same ID.');
     $this->assertNotSame($a, $c, 'Different Registry instances should be returned when requesting different ID\'s.');
 }
开发者ID:nkuitche,项目名称:registry,代码行数:14,代码来源:RegistryTest.php


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