r90544 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90543‎ | r90544 | r90545 >
Date:20:30, 21 June 2011
Author:jeroendedauw
Status:ok
Tags:
Comment:
renamed and deprecated for 1.6
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Record.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/datavalues/SMW_DV_Record.php
@@ -187,27 +187,43 @@
188188 ////// Additional API for value lists
189189
190190 /**
 191+ * @deprecated as of 1.0, use getDataItems instead
 192+ *
 193+ * @return array of SMWDataItem
 194+ */
 195+ public function getDVs() {
 196+ return $this->getDataItems();
 197+ }
 198+
 199+ /**
191200 * Create a list (array with numeric keys) containing the datavalue
192201 * objects that this SMWRecordValue object holds. Values that are not
193202 * present are set to null. Note that the first index in the array is
194203 * 0, not 1.
195204 *
196 - * @todo This method should be renamed to getDataItems().
 205+ * @since 1.6
 206+ *
197207 * @return array of SMWDataItem
198208 */
199 - public function getDVs() {
200 - if ( !$this->isValid() ) return array();
201 - $result = array();
202 - $semanticData = $this->m_dataitem->getSemanticData();
203 - foreach ( $semanticData->getProperties() as $prop ) {
204 - $propname = $prop->getPropertyID();
205 - $propnum = substr( $propname, 1 );
206 - if ( ( $propname != false ) && ( is_numeric( $propnum ) ) ) {
207 - $propertyvalues = $semanticData->getPropertyValues( $prop ); // combining this with next line violates PHP strict standards
208 - $result[( $propnum - 1 )] = reset( $propertyvalues );
209 - }
 209+ public function getDataItems() {
 210+ $dataItems = array();
 211+
 212+ if ( $this->isValid() ) {
 213+ $semanticData = $this->m_dataitem->getSemanticData();
 214+
 215+ foreach ( $semanticData->getProperties() as $prop ) {
 216+ $propname = $prop->getPropertyID();
 217+ $propnum = substr( $propname, 1 );
 218+
 219+ if ( ( $propname != false ) && ( is_numeric( $propnum ) ) ) {
 220+ // Combining this with next line violates PHP strict standards.
 221+ $propertyvalues = $semanticData->getPropertyValues( $prop );
 222+ $result[( $propnum - 1 )] = reset( $propertyvalues );
 223+ }
 224+ }
210225 }
211 - return $result;
 226+
 227+ return $dataItems;
212228 }
213229
214230 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r90552follow up to r90544jeroendedauw21:46, 21 June 2011

Status & tagging log