summaryrefslogtreecommitdiff
path: root/www/wiki/extensions/SemanticMediaWiki/src/Serializers/FlatSemanticDataSerializer.php
blob: 30f298a2aaae53f898ed38ffd94ba3e67be50b4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php

namespace SMW\Serializers;

/**
 * Only returns the head of the subobject without serializing associated
 * dataItems.
 *
 * @license GNU GPL v2+
 * @since 3.0
 *
 * @author mwjames
 */
class FlatSemanticDataSerializer extends SemanticDataSerializer {

	/**
	 * @see SemanticDataSerializer::doSerializeSubobject
	 *
	 * @return array
	 */
	protected function doSerializeSubSemanticData( $subSemanticData ) {

		$subobjects = [];

		foreach ( $subSemanticData as $semanticData ) {
			$subobjects[] = $semanticData->getSubject()->getSerialization();
		}

		return $subobjects;
	}

}