Completed
Push — master ( fd2349...bbc868 )
by Milan
21s queued 11s
created

BodyFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createBodyContent() 0 24 2
1
<?php declare(strict_types=1);
2
3
namespace h4kuna\Ares;
4
5
class BodyFactory
6
{
7
8
	/**
9
	 * @param array<string>|array<int> $identificationNumbers
10
	 */
11
	public function createBodyContent(array $identificationNumbers): string
12
	{
13
		$date = new \DateTime();
14
		$content = '
15
		<are:Ares_dotazy 
16
		xmlns:are="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_request_orrg/v_1.0.0" 
17
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
18
		xsi:schemaLocation="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_request_orrg/v_1.0.0 http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_request_orrg/v_1.0.0/ares_request_orrg.xsd" 
19
		dotaz_datum_cas="' . $date->format('Y-m-dTH:i:s') . '" 
20
		dotaz_pocet="' . count($identificationNumbers) . '" 
21
		dotaz_typ="Basic" 
22
		vystup_format="XML" 
23
		validation_XSLT="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer/v_1.0.0/ares_answer.xsl" 
24
		answerNamespaceRequired="http://wwwinfo.mfcr.cz/ares/xml_doc/schemas/ares/ares_answer_basic/v_1.0.3"
25
		Id="Ares_dotaz">
26
		';
27
28
		foreach ($identificationNumbers as $key => $in) {
29
			$content .= "<Dotaz><Pomocne_ID>$key</Pomocne_ID><ICO>$in</ICO></Dotaz>";
30
		}
31
32
		$content .= '</are:Ares_dotazy>';
33
		return $content;
34
	}
35
36
}
37