~chroot64bit/zivios/gentoo-experimental

« back to all changes in this revision

Viewing changes to application/library/Zend/Service/Simpy/TagSet.php

  • Committer: Mustafa A. Hashmi
  • Date: 2008-12-04 13:32:21 UTC
  • Revision ID: mhashmi@zivios.org-20081204133221-0nd1trunwevijj38
Inclusion of new installation framework with ties to zend layout and dojo layout

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
/**
 
4
 * Zend Framework
 
5
 *
 
6
 * LICENSE
 
7
 *
 
8
 * This source file is subject to the new BSD license that is bundled
 
9
 * with this package in the file LICENSE.txt.
 
10
 * It is also available through the world-wide-web at this URL:
 
11
 * http://framework.zend.com/license/new-bsd
 
12
 * If you did not receive a copy of the license and are unable to
 
13
 * obtain it through the world-wide-web, please send an email
 
14
 * to license@zend.com so we can send you a copy immediately.
 
15
 *
 
16
 * @category   Zend
 
17
 * @package    Zend_Service
 
18
 * @subpackage Simpy
 
19
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
20
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
21
 * @version    $Id: TagSet.php 8064 2008-02-16 10:58:39Z thomas $
 
22
 */
 
23
 
 
24
 
 
25
/**
 
26
 * @see Zend_Service_Simpy_Tag
 
27
 */
 
28
require_once 'Zend/Service/Simpy/Tag.php';
 
29
 
 
30
 
 
31
/**
 
32
 * @category   Zend
 
33
 * @package    Zend_Service
 
34
 * @subpackage Simpy
 
35
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 
36
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 
37
 */
 
38
class Zend_Service_Simpy_TagSet implements IteratorAggregate
 
39
{
 
40
    /**
 
41
     * List of tags
 
42
     *
 
43
     * @var array of Zend_Service_Simpy_Tag objects
 
44
     */
 
45
    protected $_tags;
 
46
 
 
47
    /**
 
48
     * Constructor to initialize the object with data
 
49
     *
 
50
     * @param  DOMDocument $doc Parsed response from a GetTags operation
 
51
     * @return void
 
52
     */
 
53
    public function __construct(DOMDocument $doc)
 
54
    {
 
55
        $xpath = new DOMXPath($doc);
 
56
        $list = $xpath->query('//tags/tag');
 
57
        $this->_tags = array();
 
58
 
 
59
        for ($x = 0; $x < $list->length; $x++) {
 
60
            $this->_tags[$x] = new Zend_Service_Simpy_Tag($list->item($x));
 
61
        }
 
62
    }
 
63
 
 
64
    /**
 
65
     * Returns an iterator for the tag set
 
66
     *
 
67
     * @return ArrayIterator
 
68
     */
 
69
    public function getIterator()
 
70
    {
 
71
        return new ArrayIterator($this->_tags);
 
72
    }
 
73
 
 
74
    /**
 
75
     * Returns the number of tags in the set
 
76
     *
 
77
     * @return int
 
78
     */
 
79
    public function getLength()
 
80
    {
 
81
        return count($this->_tags);
 
82
    }
 
83
}