GenericJSONConverter   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 2
dl 0
loc 14
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A convertFromDocumentInstance() 0 3 1
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
}