當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。