1 | <?php |
||
17 | class SWLPropertyChanges implements Iterator { |
||
18 | |||
19 | private $pos = 0; |
||
20 | private $currentRow = null; |
||
21 | |||
22 | /** |
||
23 | * Cache for the localized version of the namespace prefix "Property:". |
||
24 | * |
||
25 | * @var string |
||
26 | */ |
||
27 | static private $propertyPrefix = ''; |
||
28 | |||
29 | /** |
||
30 | * Array mapping property keys (string) to arrays of SWLPropertyChange. |
||
31 | * |
||
32 | * @var array of SWLPropertyChange |
||
33 | */ |
||
34 | private $changes = array(); |
||
35 | |||
36 | /** |
||
37 | * Array mapping property keys (string) to SMWDIProperty objects. |
||
38 | * |
||
39 | * @var array of SMWDIProperty |
||
40 | */ |
||
41 | private $properties = array(); |
||
42 | |||
43 | /** |
||
44 | * Indicates if there are changes in the list. |
||
45 | * |
||
46 | * @var boolean |
||
47 | */ |
||
48 | private $hasChanges = false; |
||
49 | |||
50 | /** |
||
51 | * Get the array of all properties that have changes. |
||
52 | * |
||
53 | * @return array of SMWDIProperty |
||
54 | */ |
||
55 | public function getProperties() { |
||
58 | |||
59 | /** |
||
60 | * Returns if the list contains any changes. |
||
61 | * This info is cached, so the call is cheaper then doing a count. |
||
62 | * |
||
63 | * @return boolean |
||
64 | */ |
||
65 | public function hasChanges() { |
||
68 | |||
69 | /** |
||
70 | * Get the array of all stored values for some property. |
||
71 | * |
||
72 | * @param $property SMWDIProperty |
||
73 | * |
||
74 | * @return array of SWLPropertyChange |
||
75 | */ |
||
76 | public function getPropertyChanges( SMWDIProperty $property ) { |
||
83 | |||
84 | /** |
||
85 | * Store a value for a property identified by its SMWDataItem object. |
||
86 | * |
||
87 | * @note There is no check whether the type of the given data item |
||
88 | * agrees with the type of the property. Since property types can |
||
89 | * change, all parts of SMW are prepared to handle mismatched data item |
||
90 | * types anyway. |
||
91 | * |
||
92 | * @param SMWDIProperty $property |
||
93 | * @param SWLPropertyChange $change |
||
94 | */ |
||
95 | public function addPropertyObjectChange( SMWDIProperty $property, SWLPropertyChange $change ) { |
||
109 | |||
110 | /** |
||
111 | * Store a value for a given property identified by its text label |
||
112 | * (without namespace prefix). |
||
113 | * |
||
114 | * @param string $propertyName |
||
115 | * @param SWLPropertyChange $change |
||
116 | */ |
||
117 | public function addPropertyChange( $propertyName, SWLPropertyChange $change ) { |
||
139 | |||
140 | /** |
||
141 | * Removes all changes for a certian property. |
||
142 | * |
||
143 | * @param SMWDIProperty $property |
||
144 | */ |
||
145 | public function removeChangesForProperty( SMWDIProperty $property ) { |
||
151 | |||
152 | function rewind() { |
||
156 | |||
157 | function current() { |
||
163 | |||
164 | function key() { |
||
167 | |||
168 | function next() { |
||
173 | |||
174 | function valid() { |
||
177 | |||
178 | } |
Adding explicit visibility (
private
,protected
, orpublic
) is generally recommend to communicate to other developers how, and from where this method is intended to be used.