Factory.php
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* @package AllediaFramework
* @contact www.alledia.com, hello@alledia.com
* @copyright 2016 Alledia.com, All rights reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
namespace Alledia\Framework;
defined('_JEXEC') or die();
abstract class Factory extends \JFactory
{
/**
* Instances of extensions
*
* @var array
*/
protected static $extensionInstances = array();
/**
* Get an extension
*
* @param string $namespace The extension namespace
* @param string $type The extension type
* @param string $folder The extension folder (plugins only)
*
* @return object The extension instance
*/
public static function getExtension($namespace, $type, $folder = null)
{
$key = $namespace . $type . $folder;
if (empty(self::$extensionInstances[$key])) {
$instance = new Joomla\Extension\Licensed($namespace, $type, $folder);
self::$extensionInstances[$key] = $instance;
}
return self::$extensionInstances[$key];
}
}