File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -109,4 +109,13 @@ public function getIterator() {
109109 return new ArrayIterator ( $ this ->statements );
110110 }
111111
112+ /**
113+ * Returns the map in array form. The array keys are the GUIDs of their associated statement.
114+ *
115+ * @return Statement[]
116+ */
117+ public function toArray () {
118+ return $ this ->statements ;
119+ }
120+
112121}
Original file line number Diff line number Diff line change @@ -180,4 +180,18 @@ public function testGivenStatementWithPresentGuid_addStatementReplacesThePresent
180180 $ this ->assertEquals ( $ statement2 , $ statements ->getStatementByGuid ( 'some guid ' ) );
181181 }
182182
183+ public function testToArray () {
184+ $ statement1 = $ this ->newStatement ( 1 , 'some guid ' );
185+ $ statement2 = $ this ->newStatement ( 2 , 'other guid ' );
186+
187+ $ statementMap = new StatementByGuidMap ( array ( $ statement1 , $ statement2 ) );
188+
189+ $ expectedStatements = array (
190+ 'some guid ' => $ statement1 ,
191+ 'other guid ' => $ statement2
192+ );
193+
194+ $ this ->assertEquals ( $ expectedStatements , $ statementMap ->toArray () );
195+ }
196+
183197}
You can’t perform that action at this time.
0 commit comments