本文整理匯總了PHP中KFactory::getInstance方法的典型用法代碼示例。如果您正苦於以下問題:PHP KFactory::getInstance方法的具體用法?PHP KFactory::getInstance怎麽用?PHP KFactory::getInstance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類KFactory
的用法示例。
在下文中一共展示了KFactory::getInstance方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: jimport
* @link http://www.koowa.org
*/
/**
* Compares the performance of generating a new object vs cloning
*
* @todo Replace JProfiler with KProfiler
*
* @author Mathias Verraes <mathias@joomlatools.org>
*/
jimport('joomla.error.profiler');
$config['table'] = KFactory::get('TestTableCustomers');
$prefix = 'test';
$suffix = 'customers';
$data = array('test_customer_id' => '2', 'name' => 'Bob', 'company' => 'BuildingCo', 'user_id' => '0');
// New KRow Object
$p = new JProfiler();
for ($i = 0; $i < 10000; $i++) {
$row = KFactory::getInstance('DatabaseRow', $prefix, $suffix, $config, null);
$row->setProperties($data);
}
$p->mark('New KRow object');
var_dump($p->getBuffer());
// Clone KRow Object
$p = new JProfiler();
$row = KFactory::getInstance('DatabaseRow', $prefix, $suffix, $config, null);
for ($i = 0; $i < 10000; $i++) {
$row1 = clone $row;
$row1->setProperties($data);
}
$p->mark('Clone KRow object');
var_dump($p->getBuffer());