Completed
Push — master ( dca578...2fbbce )
by Tomáš
09:39
created

SingleExporterBase::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 5
ccs 5
cts 5
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace TournamentGenerator\Export;
5
6
/**
7
 * Class SingleExportBase
8
 *
9
 * Base class for all "Single" exporters = exporting only one specific class (Team, Game) and not a hierarchy class (Tournament, Category, Round, Group).
10
 *
11
 * @package TournamentGenerator\Export
12
 * @author  Tomáš Vojík <[email protected]>
13
 * @since   0.5
14
 */
15
abstract class SingleExporterBase extends ExporterBase implements SingleExporter
16
{
17
18
	/**
19
	 * Finish the export query -> get the result
20
	 *
21
	 * @return array The query result
22
	 */
23 10
	public function get() : array {
24 10
		$data = $this->getBasic();
25 10
		$this->applyModifiers($data);
26 10
		unset($data['object']);
27 10
		return $data;
28
	}
29
30
	/**
31
	 * Finish the export query -> get the result including an object reference
32
	 *
33
	 * @return array
34
	 */
35 21
	public function getWithObject() : array {
36 21
		$data = $this->getBasic();
37 21
		$this->applyModifiers($data);
38 21
		return $data;
39
	}
40
41
}