1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-09 10:16:36 +02:00

[feature/extension-manager] Refactoring the structure of extension provider

PHPBB3-10323
This commit is contained in:
Nils Adermann
2011-08-31 17:49:48 -04:00
parent 52f5fa796f
commit 520a5f9295
13 changed files with 198 additions and 75 deletions

View File

@@ -24,9 +24,9 @@ abstract class phpbb_extension_provider implements IteratorAggregate
{
/**
* Array holding all found items
* @var array
* @var array|null
*/
protected $items = array();
protected $items = null;
/**
* An extension manager to search for items in extensions
@@ -42,8 +42,6 @@ abstract class phpbb_extension_provider implements IteratorAggregate
public function __construct(phpbb_extension_manager $extension_manager)
{
$this->extension_manager = $extension_manager;
$this->items = $this->find();
}
/**
@@ -51,7 +49,7 @@ abstract class phpbb_extension_provider implements IteratorAggregate
*
* @return array List of task names
*/
abstract function find();
abstract protected function find();
/**
* Retrieve an iterator over all items
@@ -60,6 +58,11 @@ abstract class phpbb_extension_provider implements IteratorAggregate
*/
public function getIterator()
{
if ($this->items === null)
{
$this->items = $this->find();
}
return new ArrayIterator($this->items);
}
}