forked from phpbb/phpbb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature/extension-manager] Extract extension provider functionality …
…from cron PHPBB3-10323
- Loading branch information
Showing
3 changed files
with
70 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php | ||
/** | ||
* | ||
* @package extension | ||
* @copyright (c) 2011 phpBB Group | ||
* @license http://opensource.org/licenses/gpl-license.php GNU Public License | ||
* | ||
*/ | ||
|
||
/** | ||
* @ignore | ||
*/ | ||
if (!defined('IN_PHPBB')) | ||
{ | ||
exit; | ||
} | ||
|
||
/** | ||
* Provides a set of items found in extensions | ||
* | ||
* @package extension | ||
*/ | ||
abstract class phpbb_extension_provider implements IteratorAggregate | ||
{ | ||
/** | ||
* Array holding all found items | ||
* @var array | ||
*/ | ||
protected $items = array(); | ||
|
||
/** | ||
* An extension manager to search for items in extensions | ||
* @var phpbb_extension_manager | ||
*/ | ||
protected $extension_manager; | ||
|
||
/** | ||
* Constructor. Loads all available items. | ||
* | ||
* @param phpbb_extension_manager $extension_manager phpBB extension manager | ||
*/ | ||
public function __construct(phpbb_extension_manager $extension_manager) | ||
{ | ||
$this->extension_manager = $extension_manager; | ||
|
||
$this->items = $this->find(); | ||
} | ||
|
||
/** | ||
* Finds template paths using the extension manager. | ||
* | ||
* @return array List of task names | ||
*/ | ||
abstract function find(); | ||
|
||
/** | ||
* Retrieve an iterator over all items | ||
* | ||
* @return ArrayIterator An iterator for the array of template paths | ||
*/ | ||
public function getIterator() | ||
{ | ||
return new ArrayIterator($this->items); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters