convertFromDocumentInstance()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
3
namespace OpenMindParser\Converters\JSON;
4
5
use OpenMindParser\Converters\Model\AbstractConverter;
6
use OpenMindParser\Models\Document;
7
use OpenMindParser\Models\Node;
8
use OpenMindParser\Parser;
9
use \DOMDocument;
10
11
/*A singleton to convert a document tree (object Document) in a JSON tree following few options.*/
12
class GenericJSONConverter extends AbstractConverter
13
{
14
	/**
15
	 * Perform the ocnversion in JSON by exporting the objects tree in an array tree and converting it in JSON.
16
	 * 
17
	 * @param Document $document : The Document instance to write in JSON.
18
	 * @param array $options : The options to perform the conversion.
19
	 * 
20
	 * @return String : The JSON string.
21
	 */
22
	protected function convertFromDocumentInstance(Document $document, array $options) {
23
		return json_encode($document->toArray());
24
	}
25
}