Overview

Namespaces

  • ApiAxle
    • Api
    • Shared
  • ApiAxleTest
    • Api
    • Shared
  • PHP

Classes

  • Config
  • HttpRequest
  • ItemList
  • Utilities

Exceptions

  • ApiException
  • Overview
  • Namespace
  • Class
  • Tree
  • Todo
 1: <?php
 2: /**
 3:  * ApiAxle (https://github.com/fillup/apiaxle-module)
 4:  *
 5:  * @link      https://github.com/fillup/apiaxle-module for the canonical source repository
 6:  * @license   MIT
 7:  */
 8: 
 9: namespace ApiAxle\Shared;
10: 
11: /**
12:  * Generic Iteratable Object for storing lists of meetings, attendees, or users.
13:  * 
14:  * Class extends \Iterator and adds an addItem($item) method for adding objects
15:  * to the list.
16:  * 
17:  * @author Phillip Shipley <phillip@phillipshipley.com>
18:  */
19: class ItemList implements \Iterator
20: {
21:     private $position = 0;
22:     private $items = array();
23:     
24:     public function __construct() {
25:         $this->position = 0;
26:     }
27:     
28:     /**
29:      * Add an object to list
30:      * 
31:      * @param ApiAxle\Api|Key|Keyring
32:      */
33:     public function addItem($item){
34:         $this->items[] = $item;
35:     }
36:     
37:     /**
38:      * Return size of list
39:      */
40:     public function size()
41:     {
42:         return count($this->items);
43:     }
44:     
45:     function rewind() {
46:         $this->position = 0;
47:     }
48: 
49:     function current() {
50:         return $this->items[$this->position];
51:     }
52: 
53:     function key() {
54:         return $this->position;
55:     }
56: 
57:     function next() {
58:         ++$this->position;
59:     }
60: 
61:     function valid() {
62:         return isset($this->items[$this->position]);
63:     }
64:     
65:     public function getItemsArray()
66:     {
67:         return $this->items;
68:     }
69: }
fillup/apiaxle API documentation generated by ApiGen 2.8.0