Aggregate Code Coverage for all tests
1 : <?php 2 : /** 3 : * PEAR2_Pyrus_Package_Creator_TaskIterator 4 : * 5 : * PHP version 5 6 : * 7 : * @category PEAR2 8 : * @package PEAR2_Pyrus 9 : * @author Greg Beaver <cellog@php.net> 10 : * @copyright 2008 The PEAR Group 11 : * @license http://www.opensource.org/licenses/bsd-license.php New BSD License 12 : * @version SVN: $Id$ 13 : * @link http://svn.pear.php.net/wsvn/PEARSVN/Pyrus/ 14 : */ 15 : 16 : /** 17 : * Class which iterates over all the tasks to perform for package creation. 18 : * 19 : * @category PEAR2 20 : * @package PEAR2_Pyrus 21 : * @author Greg Beaver <cellog@php.net> 22 : * @copyright 2008 The PEAR Group 23 : * @license http://www.opensource.org/licenses/bsd-license.php New BSD License 24 : * @link http://svn.pear.php.net/wsvn/PEARSVN/Pyrus/ 25 : */ 26 : class PEAR2_Pyrus_Package_Creator_TaskIterator extends FilterIterator 27 1 : { 28 : private $_inner; 29 : private $_parent; 30 : private $_tasksNs; 31 : function __construct(array $arr, PEAR2_Pyrus_Package $parent) 32 : { 33 1 : $this->_parent = $parent; 34 1 : $this->_tasksNs = $this->_parent->getTasksNs(); 35 1 : parent::__construct($this->_inner = new ArrayIterator($arr)); 36 1 : } 37 : 38 : function accept() 39 : { 40 1 : if (!$this->_inner->valid()) { 41 : return false; 42 : } 43 : 44 1 : if ($this->_inner->key() == 'attribs') { 45 : return false; 46 : } 47 : 48 1 : $key = $this->key(); 49 1 : if (strpos($key, $this->_tasksNs . ':') !== 0) { 50 : return false; 51 : } 52 : 53 1 : return true; 54 : } 55 : 56 : function current() 57 : { 58 1 : $xml = parent::current(); 59 : $task = 'PEAR2_Pyrus_Task_' . 60 1 : ucfirst(str_replace($this->_tasksNs . ':', '', $this->key())); 61 1 : $a = new $task(PEAR2_Pyrus_Config::current(), PEAR2_PYRUS_TASK_PACKAGE); 62 1 : return array($xml, $a); 63 : } 64 1 : }