Completed
Push — master ( a7ba40...b3dcaf )
by Tomáš
06:44
created

SingleExportBase::get()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

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